
package com.geofencing.repository;

import com.geofencing.model.Geofence;
import org.locationtech.jts.geom.Point;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GeofenceRepository extends JpaRepository<Geofence, Long> {
    @Query("SELECT g FROM Geofence g WHERE within(:point, g.polygon) = true")
    List<Geofence> findGeofenceContainingPoint(Point point);
}
